package com.cuitrip.business.reminder.model;

import android.view.View;

import com.cuitrip.business.order.detail.OrderFormActivity;
import com.cuitrip.push.model.PushMessageModel;
import com.cuitrip.service.R;
import com.cuitrip.util.ResourceUtil;
import com.cuitrip.util.time.InputTime;
import com.cuitrip.util.time.OutputTime;
import com.cuitrip.util.time.TimeUtil;

/**
 * Created by ak on 15/11/5.
 */
public class TripCommentViewHolder extends ReminderInfoViewHolder {

    @Override
    public void render(final PushMessageModel object) {
        serviceName.setText(object.getServiceName());
        title.setText(ResourceUtil.getString(R.string.book_popup_review));
        if (object.getUserType() != PushMessageModel.TRAVELLER){
            subTitle.setText(ResourceUtil.getString(R.string.book_popup_review_desc, object.getTravllerNick()));
            secondAction.setText(ResourceUtil.getString(R.string.operation_view_detail));
            firstAction.setVisibility(View.GONE);
            secondAction.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dismiss();
                    if (mWeakHostActivity.get().isNeedChangeType()){
                        changeType("cuitrip://order?oid=" + object.getMessageId());
                    }else{
                        OrderFormActivity.start(mWeakHostActivity.get(),object.getMessageId());
                    }
                }
            });
        }

        String timeFormat = TimeUtil.formatTime(
                InputTime.build(object.getServiceDate(), TimeUtil.getZeroZone()),
                OutputTime.getInstance(OutputTime.OutputType.Type_DAY, TimeUtil.getZeroZone()));
        dateText.setText(timeFormat);
        actionStatus.setText(ResourceUtil.getString(R.string.correct_icon));


    }


}
